/**
 * @param {number[]} nums
 * @return {number[][]}
 */
var subsets = function (nums) {
  let path = []
  let res = []
  function backtracking(k) {
    res.push([...path])
    for(let i=k;i<nums.length;i++){
      path.push(nums[i])
      backtracking(i+1)
      path.pop()
    }
  }
  backtracking(0)
  return res
}

subsets([0])
